<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<jsp:include page="head.jsp" />
<body>
<jsp:include page="top.jsp" />
<jsp:include page="menuscript.jsp" />
<jsp:include page="workspace.normal.jsp" />
<script type="text/javascript">
Ext.onReady( function() {
	Ext.QuickTips.init();
	Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

	var treePanel = new Ext.tree.TreePanel( {
		autoScroll : false,
		collapsible : false,
		containerScroll : false,
		rootVisible : false,
		bodyBorder : false,
		lines : false,
		loader : new Ext.tree.TreeLoader( {
			dataUrl : sidebar_load_url
			
		}),
		root : new Ext.tree.AsyncTreeNode( {
			text : sidebar_title
		})
	});
    var treeState = Ext.state.Manager.get(sidebar_load_url);
    if (treeState) {
    	treePanel.expandPath(treeState);
    }
    treePanel.on('expandnode', function (x, y){
   		Ext.state.Manager.set(sidebar_load_url, x.getPath());
	});
    treePanel.on('collapsenode', function (x, y){ 
   		Ext.state.Manager.set(sidebar_load_url, x.getPath());
    });

	var filterTreePanel = new Ext.Panel( {
		region : 'west',
		id: sidebar_id,
		width : 200,
		minSize : 150,
		maxSize : 250,
		split : true,
		title : sidebar_title,
		
		/**
		bbar : [ {
			text : '<bean:message key="global.search" bundle="global" />'
		}, {
			xtype : 'textfield',
			id : 'filter',
			selectOnFocus : true,
			width : 80
		}, {
			text : '<bean:message key="global.action.confirm" bundle="global" />'
		} ],
		**/

		items : treePanel,

		autoScroll : true,
		collapsible : true
	});
	
	var viewport = new Ext.Viewport( {
		id : 'hxlayout',
		layout : 'border',
		layoutConfig : {
			animate : true
		},
		defaults : {
			border : false
		},
		items : [ {
			region : 'north',
			id : 'top-panel',
			contentEl : 'top',
			height : 120
		}, filterTreePanel, {
			region : 'center',
			id : 'workspace-panel',
			contentEl : 'workspace',
			autoScroll : true,
			split : true,
			listeners : {
				//To fix the bug on the execution of javascript in ie. 
				resize : (typeof initws == 'function'? initws : function(){})
			}
		} ]
	});
});
</script>
<tiles:insert attribute="tree_load_url" />
<jsp:include page="foot.jsp" />
</body>
</html>